@extends('backend/layouts/default')
@section('title')
Danh sách chuyên mục
@stop
@section('content')
<h3>
    <span class="glyphicon glyphicon-pencil"></span> Danh sách hợp âm
    @if(Sentry::getUser()->hasAnyAccess(['category','category.create']))
    <a href="{{ route('create/categories/admin') }}" class="btn btn-default btn-xs"><span
            class="glyphicon glyphicon-plus-sign"></span> Chuyên mục mới</a>
    @endif
</h3>
<div class="box">
    <div class="box-header">
    </div>
    <!-- /.box-header -->
    <div class="box-body">
        <div class="row">
            <div class="col-ld-2 col-md-3 col-sm-3">
                <ul class="nav nav-pills nav-stacked">
                    <li <?= $data['appends']['status'] == 'on' ? 'class="active"' : "" ?>>
                        <a href="{{ route('categories/admin') }}"><span class="glyphicon glyphicon-ok-sign"></span>
                            Tất cả
                        </a>
                    </li>
                    <li class="<?= $data['appends']['status'] == 'off' ? 'active' : '' ?>">
                        <a href="<?= route('categories/admin', array('status' => 'off')) ?>">
                            <span class="glyphicon glyphicon-off"></span>
                            Đang hiển thị
                        </a>
                    </li>

                    <li class="<?= $data['appends']['onlyTrashed'] == true ? 'active' : '' ?>">
                        <a href="<?= route('categories/admin', array('onlyTrashed' => true)) ?>">
                            <span class="glyphicon glyphicon-trash"></span>
                            Đã xóa
                        </a>
                    </li>
                    <li

                </ul>
            </div>
            <div class="col-ld-10 col-md-9 col-sm-9">

                <hr/>
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th width="60"></th>
                        <th class="span6">Tiêu đề</th>
                        <th class="span2"># Bài viết</th>
                        <th class="span2"># Hợp âm</th>
                        <th class="span2"># Video</th>
                        <th class="span2">Trạng thái</th>
                        <th width="150">Tác vụ</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($data['categories'] as $category)
                    <tr>
                        <td>{{ $category->id}}</td>
                        <td>{{ $category->title }}</td>
                        <td><?= $category->lessons()->count() ?></td>
                        <td><?= $category->lyrics()->count() ?></td>
                        <td>{{ $category->videos()->count() }}</td>
                        <td><?= Config::get('constants.ON_OFF_STATUS')[$category->status] ?></td>
                        <td>
                            @if ( Sentry::getUser()->hasAnyAccess(['category','category.edit']) )
                            <a href="{{ route('update/categories/admin', $category->id) }}" class="btn btn-xs btn-default">@lang('button.edit')</a>
                            @endif
                            @if ( Sentry::getUser()->hasAnyAccess(['category','category.delete']) )
                            <a href="{{ route('delete/categories/admin', $category->id) }}" class="btn btn-mini btn-danger">@lang('button.delete')</a>
                            @endif
                        </td>
                    </tr>
                    @endforeach
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@stop